-
Notifications
You must be signed in to change notification settings - Fork 816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 2085 #2136
Fix issue 2085 #2136
Conversation
@@ -114,8 +114,8 @@ HttpCredentials::HttpCredentials(const QString &user, const QString &password, c | |||
, _ready(true) | |||
, _clientSslKey(key) | |||
, _clientSslCertificate(certificate) | |||
, _keychainMigration(false) | |||
, _retryOnKeyChainError(false) | |||
, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, there's a couple of weird formatting happening. Let's keep the clang-tidy fix aside for now. I need to fix the CI integration first anyway.
src/gui/owncloudgui.cpp
Outdated
bool macos = false; | ||
#ifdef Q_OS_MAC | ||
macos = true; | ||
#endif | ||
|
||
if(reason == QSystemTrayIcon::Trigger || | ||
(macos && reason == QSystemTrayIcon::Context)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of that construct, I think I'd prefer either something like:
#ifdef Q_OS_MAC
if (reason == QSystemTrayIcon::Trigger || reason == QSystemTryIcon::Context) {
#else
if (reason == QSystemTrayIcon::Trigger) {
#endif
or:
#ifdef Q_OS_MAC
constexpr auto macos = true;
#else
constexpr auto macos = false;
#endif
if (reason == QSystemTrayIcon::Trigger || (macos && reason == QSystemTryIcon::Context)) {
Also somehow you changed the coding style of the if (space got removed before the opening parenthesis and after the closing one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh BTW... I hoped we didn't even need to do this... out of curiosity, what happens if you unconditionally leave Context in the if? The context menu doesn't show up anymore on Linux and Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh BTW... I hoped we didn't even need to do this... out of curiosity, what happens if you unconditionally leave Context in the if? The context menu doesn't show up anymore on Linux and Windows?
You are right I don't need to check for the context click. I just need to test this on mac os now that I have access to one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After you add your new account the menu is displayed in a weird position (more to the left of the systray away from the nc icon instead of near the nc systray icon)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think I have been unclear earlier.
What I meant was: I wonder if we even need to change anything at all in slotTrayClicked
!
Indeed, if we're on Mac we test for the QSystemTrayIcon::Context
reason and we didn't call setContextMenu
so we'll display the main dialog in both left and right click. If we're not on Mac, we called setContextMenu
... then I wonder if we get QSystemTrayIcon::Context
delivered at all. If not, then we don't need to change slotTrayClicked
otherwise... well, we'll need to do something in slotTrayClicked
indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it and it worked too.
2532133
to
a8306d1
Compare
src/gui/systray.cpp
Outdated
@@ -79,6 +80,14 @@ Systray::Systray() | |||
} | |||
); | |||
|
|||
#ifndef Q_OS_MAC | |||
auto contextMenu = new QMenu(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems busted in that block.
Also the request from @jancborchardt was to have: "Open Main Dialog", "Settings" and "Quit" in that menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the main dialog? Is it the new systray menu or the mains window with the settings and network?
desktop/src/gui/application.cpp
Line 667 in be4ba03
_gui->slotOpenMainDialog(); |
I would say this call after the user created his account needs to open the window with the settings not the new systray menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the main dialog? Is it the new systray menu or the mains window with the settings and network?
It is the new window you get when clicking on the systray. We call that the "main dialog" now, the other one being the "settings dialog".
desktop/src/gui/application.cpp
Line 667 in be4ba03
_gui->slotOpenMainDialog(); I would say this call after the user created his account needs to open the window with the settings not the new systray menu.
Dunno... I don't think I mind either way. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Undid it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the request from @jancborchardt was to have: "Open Main Dialog", "Settings" and "Quit" in that menu
Sorry, I just wrote that in the chat based on what the things should do, not the exact wording. It should of course reflect the wording we use in the main dialog:
- Open main dialog (only first word capitalized
- Settings
- Quit Nextcloud
Since we had the point brought up in the chat as well, we could take the opportunity to change it to "Exit Nextcloud" instead, here as well as in the main dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/gui/owncloudgui.cpp
Outdated
#endif | ||
|
||
// for mac os right and left click trigger the same behavior | ||
if (reason == QSystemTrayIcon::Trigger || macos){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we still have a change in here (see my other comment), it really should be || (macos && reason == QSystemTrayIcon::Trigger)
and not just || macos
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it.
src/gui/owncloudgui.cpp
Outdated
_settingsDialog->showSettingsPage(); | ||
} | ||
|
||
void ownCloudGui::slotShowMainDialog() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrongly named, this really shows the settings dialog not the main dialog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
b456025
to
140f50f
Compare
src/gui/owncloudgui.cpp
Outdated
void ownCloudGui::slotShowSettings() | ||
{ | ||
if (_settingsDialog.isNull()) { | ||
_settingsDialog = new SettingsDialog(this); | ||
_settingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); | ||
_settingsDialog->show(); | ||
if (!AccountManager::instance()->accounts().isEmpty()) { | ||
if (_settingsDialog.isNull()) { | ||
_settingsDialog = new SettingsDialog(this); | ||
_settingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); | ||
_settingsDialog->show(); | ||
} | ||
raiseDialog(_settingsDialog.data()); | ||
} else { | ||
slotNewAccountWizard(); | ||
} | ||
raiseDialog(_settingsDialog.data()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Windows and works fine except when no accounts are configured, then the Settings option only brings up the account wizard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly it's a side-effect this fix wasn't supposed to tackle... but to be fair, isn't it what we'd want nowadays? Because you can't add accounts from the settings dialog anymore it's triggered from the main dialog. Ah but then you wouldn't be able to set a proxy before creating an account... that could be a problem I guess.
Maybe that chunk should be reverted then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted.
src/gui/owncloudgui.cpp
Outdated
void ownCloudGui::slotShowSettings() | ||
{ | ||
if (_settingsDialog.isNull()) { | ||
_settingsDialog = new SettingsDialog(this); | ||
_settingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); | ||
_settingsDialog->show(); | ||
if (!AccountManager::instance()->accounts().isEmpty()) { | ||
if (_settingsDialog.isNull()) { | ||
_settingsDialog = new SettingsDialog(this); | ||
_settingsDialog->setAttribute(Qt::WA_DeleteOnClose, true); | ||
_settingsDialog->show(); | ||
} | ||
raiseDialog(_settingsDialog.data()); | ||
} else { | ||
slotNewAccountWizard(); | ||
} | ||
raiseDialog(_settingsDialog.data()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admittedly it's a side-effect this fix wasn't supposed to tackle... but to be fair, isn't it what we'd want nowadays? Because you can't add accounts from the settings dialog anymore it's triggered from the main dialog. Ah but then you wouldn't be able to set a proxy before creating an account... that could be a problem I guess.
Maybe that chunk should be reverted then?
0c9b464
to
3c5eec1
Compare
src/gui/owncloudgui.cpp
Outdated
@@ -145,7 +148,7 @@ void ownCloudGui::slotOpenSettingsDialog() | |||
// if account is set up, start the configuration wizard. | |||
if (!AccountManager::instance()->accounts().isEmpty()) { | |||
if (_settingsDialog.isNull() || QApplication::activeWindow() != _settingsDialog) { | |||
slotShowSettings(); | |||
slotOpenMainDialog(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, shouldn't that be slotShowSettings()
?
I mean the check on the if is all about the _settingsDialog
being active so it's surprising to then go and open something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted.
src/gui/owncloudgui.cpp
Outdated
@@ -85,6 +85,9 @@ ownCloudGui::ownCloudGui(Application *parent) | |||
connect(_tray.data(), &Systray::openHelp, | |||
this, &ownCloudGui::slotHelp); | |||
|
|||
connect(_tray.data(), &Systray::openMainDialog, | |||
this, &ownCloudGui::slotOpenSettingsDialog); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You meant slotOpenMainDialog
here, didn't you? Otherwise it'd show the settings dialog when we click on "Open main dialog" I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what I wanted with this: to check if the user was logged in or not. That is what slotOpenSettingsDialog does... and that is why I had added that code to slotShowSettings... I guess I should just display the main dialog.
src/gui/systray.cpp
Outdated
@@ -93,6 +102,8 @@ void Systray::create() | |||
_trayEngine->rootContext()->setContextProperty("activityModel", UserModel::instance()->currentActivityModel()); | |||
} | |||
_trayEngine->load(QStringLiteral("qrc:/qml/src/gui/tray/Window.qml")); | |||
|
|||
_trayEngine->rootContext()->setContextProperty("appNameGUI", Theme::instance()->appNameGUI()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change it now. FYI we'll have to change that later on, context properties are deprecated, that's why we got Nico's patches to switch to QML singletons. That can wait.
Update systray behavior and context menu: - left click brings up the new QtQuick based dialogs on all latforms - right click brings up the new QtQuick based dialog on Mac OS only - right click brings up a context menu on all other platforms than Mac OS - "Quit Nextcloud" => "Exit Nextcloud" - Add "Open main dialog" option. Signed-off-by: Camila <[email protected]>
The offending part was reverted, so good to go now
I got to test this now and this feels just right in KDE now! Thanks for this! |
Update systray behavior and context menu:
open settings slot to correctly show the settings.
Fix #2085
to do